import docx
from docx.enum.text import WD_ALIGN_PARAGRAPH  # 导入docx枚举
from docx.shared import Inches
from docx.oxml.ns import qn

doc = docx.Document()  # 读取D盘下的邀请函.docx 文件
doc.styles['Normal'].font.name = u'宋体'
doc.styles['Normal']._element.rPr.rFonts.set(qn('w:eastAsia'), u'宋体')
paragraph = doc.add_paragraph('年会邀请函')
paragraph_format = paragraph.paragraph_format 
paragraph_format.alignment = WD_ALIGN_PARAGRAPH.CENTER
doc.add_paragraph('尊敬的 **** 先生/女士：')
paragraph2 = doc.add_paragraph()
paragraph_format2 = paragraph2.paragraph_format
paragraph_format2.left_indent = Inches(0.5)
run = paragraph2.add_run('邀请您参加我们公司的年会')
from docx.shared import Pt
run.bold = True
run.font.size = Pt(21)
run.font.italic =True
run.font.name = 'Times New Roman'
doc.save('D://邀请函_addText.docx')   # 保存更改